<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout/layout}">
<head>
    <!--添加jquery-ui支持-->
    <link rel="stylesheet" th:href="@{/css/jquery-ui.min.css}"/>
</head>
<body>
<div layout:fragment="content">
    <h1 th:text="#{user.inf}">员工信息</h1>

    <div>
        <form id="userForm" class="form-horizontal" th:action="@{/admin/user/edit}" th:object="${user}" method="post">
            <input type="hidden" th:field="*{id}"/>
            <div class="form-group">
                <label for="username" class="col-sm-1 control-label"  th:text="#{user.username}">账号</label>
                <div class="col-sm-2">
                    <input type="text" th:field="*{username}" class="form-control" required minlength="5" maxlength="20" th:placeholder="#{user.username}"/>
                    <p th:if="${#fields.hasErrors('username')}" th:errors="*{username}" class="error">账号错误</p>
                </div>
                <label for="enable" class="col-sm-1 control-label" th:text="#{user.enable}">是否在职</label>
                <div class="col-sm-2">
                    <input type="checkbox" th:field="*{enable}" />
                </div>
                <label for="userGroup" class="col-sm-1 control-label">分店</label>
                <div class="col-sm-2">
                    <select class="form-control" th:field="*{userGroup}" required>
                        <option th:each="var : ${userGroupList}" th:value="${var.id}" th:text="${var.no + ' ' + var.name}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-5">
                    <input type="submit" th:value="#{submit}" class="btn btn-info"/>
                    &nbsp; &nbsp; &nbsp;
                    <a href="/admin/user/list" th:href="@{/admin/user/list}" class="btn btn-info" th:text="#{back}">返回</a>
                </div>
            </div>
        </form>
    </div>
</div>
<th:block layout:fragment="pagescript">

    <script th:src="@{/js/jquery-ui/jquery-ui.datepicker-zh-CN.js}"></script>
    <script th:inline="javascript">
        $(document).ready(function () {
            $('#morningDate').datepicker({
                changeMonth: true,
                changeYear: true,
                showWeek: true,
                firstDay: 0,
                showOtherMonths: true,
                selectOtherMonths: true,
                showAnim: 'slideDown'
            });
        });
    </script>

</th:block>
</body>
</html>
